A New Method for Generating Permutations in Lexicographic Order

نویسنده

  • TING KUO
چکیده

First, an ordinal representation scheme for permutations is defined. Next, an “unranking” algorithm that can generate a permutation of n items according to its ordinal representation is designed. By using this algorithm, all permutations can be systematically generated in lexicographic order. Finally, a “ranking” algorithm that can convert a permutation to its ordinal representation is designed. By using these “ranking” and “unranking” algorithms, any permutation that is positioned in lexicographic order, away from a given permutation by any specific distance, can be generated. This significant benefit is the main difference between the proposed method and previously published alternatives. Three other advantages are as follows: First, not being restricted to sequentially numbering the n items from one to n, this method can even handle items with non-numeral marks without the aid of mapping. Second, this approach is well suited to a wide variety of permutation generations such as alternating permutations and derangements. Third, the proposed method can also be extended to a multiset.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Multiset Permutations in Lexicographic Order

In a previous work [12], we proposed a method for generating permutations in lexicographic order. In this study, we extend it to generate multiset permutations. A multiset is a collection of items that are not necessarily distinct. The guideline of the extension is to skip, as soon as possible, those partially-formed permutations that are less than or equal to the latest generated eligible perm...

متن کامل

K-sorted Permutations with Weakly Restricted Displacements

A permutation ) ( 2 1 n π π π π  = of {1, 2,..., n} is called k-sorted if and only if , k i i ≤ −π for all . 1 n i ≤ ≤ We propose an algorithm for generating the set of all k-sorted permutations of {1, 2,..., n} in lexicographic order. An inversion occurs between a pair of ( i π , j π ) if i < j but i π > j π . Let I(n, k) denote the maximum number of inversions in k-sorted permutations. For k...

متن کامل

Efficient Algorithms to Rank and Unrank Permutations in Lexicographic Order

We present uniform and non-uniform algorithms to rank and unrank permutations in lexicographic order. The uniform algorithms run in O(n log n) time and outperform Knuth’s ranking algorithm in all the experiments, and also the lineartime non-lexicographic algorithm of Myrvold-Ruskey for permutations up to size 128. The non-uniform algorithms generalize Korf-Schultze’s linear time algorithm yet r...

متن کامل

Linear-Time Ranking of Permutations

A lexicographic ranking function for the set of all permutations of n ordered symbols translates permutations to their ranks in the lexicographic order of all permutations. This is frequently used for indexing data structures by permutations. We present algorithms for computing both the ranking function and its inverse using O(n) arithmetic operations.

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2009